<?php

    #-------------------------------------------------------------#
	# This file is part of the Tekuna MVC Microframework for PHP. #
	# (c) 2009 Niels Jäckel <niels.jaeckel@tekuna.org>            #
	# Please visit http://tekuna.org/ for more information.       #
	#                                                             #
	# This software is licensed under the MIT License. Please     #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#


	Tekuna :: load('org.tekuna.core.filter.TekunaFilter');


	/**
	 * This filter removes all special character from the input.
	 * As normal characters the following are considered:
	 *
	 *   - a-z
	 *   - A-Z
	 *   - 0-9
	 *   - ,
	 *   - .
	 *   - :
	 *   - ;
	 *   - !
	 *   - -
	 *   - _
	 *
	 * This filter could be used as a sanitizer for simple texts.
	 *
	 * NOTE: German umlauts are filtered out.
	 */

	class NoSpecialCharsFilter implements TekunaFilter {


		/**
		 * Replaces all special characters by the empty string
		 *
		 * @param mixed $mInput
		 * @return string no more special characters
		 */

		public function filter($mInput) {

			return preg_replace('~[^a-zA-Z0-9,\.;:!\-_ ]~', '', $mInput);
		}
	}
